package com.xiaoc.bulldozer.common.model;

import java.io.Serializable;

/**
 * 用户信息
 * 
 * @author CodeGenerator
 * @date 2014-05-20 17:26:51
 */
public class User implements Serializable {
    
    private static final long serialVersionUID = -2191906582078401427L;

    /**
     * 密码正则表达式, 密码为6-14位字母+数字组合
     */
    public static final String PASSWORD_REGEX = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,14}$";
    
    /**
     * 密码校验提示信息
     */
    public static final String PASSWORD_VALID_MSG = "密码为6-14位字母+数字组合";
    
	/**
	 * 默认密码
	 */
	public static final String DEFAULT_PASSWORD = "SDBZDWJQLKSL";
    
	/**
     * 删除状态
     */
    public static final Integer STATUS_DISABLE = 0;
    
    /**
     * 启用状态
     */
    public static final Integer STATUS_ENABLE = 1;

    /**
     * 锁定状态
     */
    public static final Integer STATUS_LOCK = 2;
    
	/**
	 * ID
	 */
	private Integer id;

	/**
	 * 账号
	 */
	private String loginName;

	/**
	 * 密码
	 */
	private String loginPwd;

	/**
	 * 姓名
	 */
	private String name;

	/**
	 * 状态 0为删除, 1为启用, 2为锁定
	 */
	private Integer enableStatus;

	/**
	 * 创建时间
	 */
	private Long createTime;
	
	/**
	 * 更新时间
	 */
	private Long updateTime;
	
	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the loginName
	 */
	public String getLoginName() {
		return loginName;
	}

	/**
	 * @param loginName the loginName to set
	 */
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	/**
	 * @return the loginPwd
	 */
	public String getLoginPwd() {
		return loginPwd;
	}

	/**
	 * @param loginPwd the loginPwd to set
	 */
	public void setLoginPwd(String loginPwd) {
		this.loginPwd = loginPwd;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

    /**
     * @return the enableStatus
     */
    public Integer getEnableStatus() {
        return enableStatus;
    }

    /**
     * @param enableStatus the enableStatus to set
     */
    public void setEnableStatus(Integer enableStatus) {
        this.enableStatus = enableStatus;
    }

    /**
     * @return the updateTime
     */
    public Long getUpdateTime() {
        return updateTime;
    }

    /**
     * @param updateTime the updateTime to set
     */
    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    /**
	 * 判断用户是否可用
	 * 
	 * @return true 为可用, false为不可用
	 */
	public boolean isEnable() {
		return STATUS_DISABLE.compareTo(this.enableStatus) != 0;
	}

	public Long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Long createTime) {
		this.createTime = createTime;
	}

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "User [id=" + id + ", loginName=" + loginName + ", loginPwd=" + loginPwd 
                + ", name=" + name + " enableStatus=" + enableStatus + ", createTime="
                + createTime + ", updateTime=" + updateTime + "]";
    }
}
